package com.awifi.dbus.action;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.awifi.dbus.model.User;
import com.awifi.dbus.service.IUserService;

@Controller("userAction")
@Scope("prototype")
public class UserAction {
	private User user;
	private IUserService userService;
	private int id;
	
	

	public UserAction() {
		super();
	}


	public UserAction(IUserService userService) {
		super();
		this.userService = userService;
	}


	public void add( ){
		userService.add(user);
	}
	
	
	public void del( ){
		userService.del(id);
	}
	
	public void load( ){
		userService.load(id);
	}


	public User getUser() {
		return user;
	}


	public void setUser(User user) {
		this.user = user;
	}


	public IUserService getUserService() {
		return userService;
	}

	//默认通过名称来注入,也可以指定名字 从 Spring 中获取对象
	@Resource(name="userService")
	public void setUserService(IUserService userService) {
		this.userService = userService;
	}


	public int getId() {
		return id;
	}


	public void setId(int id) {
		this.id = id;
	}
	
	
}
